home *** CD-ROM | disk | FTP | other *** search
/ PhotoDisc: www.hat are you scared of? / Webtherapy (PhotoDisc) (1998).iso / mac / Internet Setup / Modem Scripts / Dircon - AT&F&K3&C1&D0%C0 / Dircon - AT&F&K3&C1&D0¿ next >
Text File  |  1998-04-23  |  10KB  |  516 lines

  1. !  Dircon - AT&F&K3&C1&D0%C0
  2. !    Author:    Kris Kreutzman
  3. !
  4. !    Copyright:    ⌐ 1991-1996 Apple Computer, Inc.    All Rights Reserved.
  5. !
  6. !    revision history:
  7. !        v2.1    as shipped with the ARA 2.1
  8. !
  9. !  'mlts' resource info for this modem:
  10. !    byte 1 == 01 -> modem HAS built-in error correction protocols
  11. !    byte 2 == 01 -> modem HAS built-in data compression protocols
  12. !    byte 3 == 40 -> max number of chars in varstr 7
  13. !    byte 4 == 40 -> max number of chars in varstr 8
  14. !    byte 5 == 40 -> max number of chars in varstr 9
  15. !    
  16. @ORIGINATE
  17. @ANSWER
  18. !
  19. ! ---- Initial modem setup ----
  20. !
  21. ! Set serial port speed depending upon the compression flag
  22. !    A higher rate with compression on to handle expanded data from the modem
  23. !    A lower rate closer to the DCE when compression is off
  24. ifstr 5 1 "0"
  25. serreset 57600, 0, 8, 1
  26. jump 2
  27. !
  28. @LABEL 1
  29. serreset 38400, 0, 8, 1
  30. !
  31. @LABEL 2
  32. hsreset 0 0 0 0 0 0
  33. settries 0
  34. !
  35. ! Get the modem's attention
  36. !
  37. matchclr
  38. matchstr 1 3 "OK\13\10"
  39. write "AT\13"
  40. matchread 30
  41. !
  42. @LABEL 3
  43. !
  44. ! Setup the modem for the following:
  45. !   Reset to factory settings
  46. !   Standard compression/reliablity
  47. !   Lock serial port speed
  48. !   Serial port hardware handshaking, turn off software handshaking
  49. !   Verbose responces and compression/protocol results
  50. !   CONNECT returns DCE speed
  51. !   Turn off answering
  52. !   Reset or return to command mode on DTR toggle (optional)
  53. !
  54. matchclr
  55. matchstr 1 4   "OK\13\10"
  56. matchstr 2 101 "ERROR\13\10"
  57. write "AT&F&K3&C1&D0%C0\13"
  58. matchread 30
  59. inctries
  60. iftries 3 101
  61. !
  62. ! Reset the Modem on setup failure
  63. !
  64. DTRClear
  65. pause 5
  66. DTRSet
  67. flush
  68. jump 3
  69. !
  70. !
  71. @LABEL 4
  72. ! Varstring 4 , reliable link protocol:
  73. !    = 0, handled by computer (ARAP)
  74. !    = 1, handled by modem (PPP)
  75. !    = 2, MNP10 protocol (Cellular protocol, no longer supported)
  76. ifstr 4 5 "1"
  77. ifstr 4 5 "2"
  78. !
  79. ! Varstring 4 == 0, turn off reliable link protocol in modem (ARAP)
  80. matchclr
  81. matchstr 1 9 "OK\13\10"
  82. write "AT\13"
  83. matchread 30
  84. jump 101
  85. !
  86. !
  87. @LABEL 5
  88. ! Varstring 5, compression protocol:
  89. !    = 0, handled by computer 
  90. !    = 1, handled by modem
  91. ifstr 5 9 "1"
  92. !
  93. ! Varstring 5 == 0, turn off compression protocol in modem.
  94. matchclr
  95. matchstr 1 9 "OK\13\10"
  96. write "AT\13"
  97. matchread 30
  98. jump 101
  99. !
  100. !
  101. @LABEL 9
  102. ! Varstring 2, modem speaker:
  103. !    = 0, speaker off
  104. !    = 1, speaker on
  105. ifstr 2 13 "1"
  106. pause 5
  107. matchclr
  108. matchstr 1 13 "OK\13\10"
  109. write "ATM0\13"
  110. matchread 30
  111. jump 101
  112. !
  113. ! Modem ready, wait for a call or originate a call
  114. !
  115. @LABEL 13
  116. ifANSWER 32
  117. !
  118. !
  119. ! ---- Originating a call ----
  120. !
  121. ! Varstring 6, dialing mode:
  122. !    = 0, normal dialing
  123. !    = 1, blind dialing
  124. !    = 2, manual dialing
  125. ifstr 6 17 "1"
  126. ifstr 6 15 "2"
  127. jump 19
  128. !
  129. @LABEL 15
  130. ! Display ASK dialog with message.  Goto label 107 if dialog canceled.
  131. ASK 2 "Pick up the phone & dial ^1.  Hit OK when the phone rings, then hangup." 107
  132. note "Manual dialing initiated" 3
  133. ! X1 to ignore dialtone & busy, D to dial, \^ generates data tone
  134. write "ATX1D\^\13"
  135. jump 32
  136. !
  137. @LABEL 17
  138. note "Dialing without tone" 3
  139. matchclr
  140. matchstr 1 19 "OK\13\10"
  141. ! X1 to ignore dialtone & busy
  142. write "ATX1\13"
  143. matchread 30
  144. jump 101
  145. !
  146. !
  147. @LABEL 19
  148. ! Display the full dialstring contained in Varstring 1
  149. note "Dialing ^1" 3
  150. !
  151. ! Varstrings 7, 8 and 9, contain dialstring fragments
  152. !    Long phone numbers may need to be split into smaller groups
  153. !    for the modem to use
  154. !
  155. ! Varstring 3:  "p" for pulse & "t" for tone dialing
  156. ! Varstring 8 == blank (dialstring in varstring 7)
  157. ! Varstring 9 == blank (dialstring in varstrings 7 & 8)
  158. ! Otherwise (dialstring in varstrings 7, 8 & 9)
  159. ! \^ is added to the dialstring to force the modem to generate a data tone
  160. ifstr 8 27 " "
  161. ifstr 9 24 " "
  162. !
  163. !  Write dialstring in varstrings 7, 8 & 9
  164. matchclr
  165. matchstr 1 21 "OK\13\10"
  166. write "ATD^3\^^7;\13"
  167. matchread 400
  168. jump 101
  169.  
  170. @LABEL 21
  171. matchclr
  172. matchstr 1 22 "OK\13\10"
  173. write "ATD^3^8;\13"
  174. matchread 400
  175. jump 101
  176.  
  177. @LABEL 22
  178. write "ATD^3^9\13"
  179. jump 32
  180. !
  181. !
  182. @LABEL 24
  183. !  Write dialstring in varstrings 7 & 8
  184. matchclr
  185. matchstr 1 25 "OK\13\10"
  186. write "ATD^3\^^7;\13"
  187. matchread 400
  188. jump 101
  189.  
  190. @LABEL 25
  191. write "ATD^3^8\13"
  192. jump 32
  193. !
  194. @LABEL 27
  195. !  Write dialstring in varstring 7
  196. write "ATD^3\^^7\13"
  197. !
  198. !
  199. !    ---- Connection responce ----
  200. !
  201. ! The following section will parse modem responces of two types:
  202. !   1) PROTOCOL: xxx, COMPRESSION: xxx, CONNECT xxx
  203. !   2) CONNECT xxx/ARQ/V42
  204. !
  205. @LABEL 32
  206. matchclr
  207. matchstr  1 81  "RING\13\10"
  208. matchstr  2 102 "NO DIALTONE\13\10"
  209. matchstr  3 103 "NO CARRIER"
  210. matchstr  4 103 "ERROR\13\10"
  211. matchstr  5 104 "BUSY\13\10"
  212. matchstr  6 105 "NO ANSWER\13\10"
  213. matchstr  7 33  "CONNECT "
  214. matchstr  8 32  "CARRIER"
  215. matchstr  9 40  "CONNECT\13\10"
  216. matchstr 10 62  "PROTOCOL: LAP"
  217. matchstr 11 62  "PROTOCOL: MNP"
  218. matchstr 12 62  "PROTOCOL: ALT"
  219. matchstr 13 67  "COMPRESSION: V"
  220. matchstr 14 67  "COMPRESSION: MNP5"
  221. matchstr 15 67  "COMPRESSION: CLASS"
  222. matchread 700
  223. ifANSWER 32
  224. jump 101
  225. !
  226. !  Parse the speed of connect result codes
  227. !  2400 and 4800 have two entries each
  228. !  to distinguish them from 24000 and 48000
  229. !
  230. @LABEL 33
  231. matchclr
  232. matchstr  1 40 "2400\13"
  233. matchstr  2 40 "2400/"
  234. matchstr  3 41 "4800\13"
  235. matchstr  4 41 "4800/"
  236. matchstr  5 42 "7200"
  237. matchstr  6 43 "9600"
  238. matchstr  7 44 "12000"
  239. matchstr  8 45 "14400"
  240. matchstr  9 46 "16800"
  241. matchstr 10 47 "19200"
  242. matchstr 11 48 "21600"
  243. matchstr 12 49 "24000"
  244. matchstr 13 50 "26400"
  245. matchstr 14 51 "28800"
  246. matchstr 15 52 "31200"
  247. matchstr 16 53 "33600"
  248. matchstr 17 54 "38400"
  249. matchstr 18 55 "48000"
  250. matchstr 19 56 "56000"
  251. matchstr 20 57 "57600"
  252. matchstr 21 58 "64000"
  253. matchread 30
  254. jump 59
  255. !
  256. ! -- Connection rates --
  257. ! CommunicatingAt informs ARA of the raw modem to modem
  258. ! connection speed.
  259. !
  260. @LABEL 40
  261. note "Communicating at 2400 bps." 2
  262. CommunicatingAt 2400
  263. jump 60
  264. !
  265. @LABEL 41
  266. note "Communicating at 4800 bps." 2
  267. CommunicatingAt 4800
  268. jump 60
  269. !
  270. @LABEL 42
  271. note "Communicating at 7200 bps." 2
  272. CommunicatingAt 7200
  273. jump 60
  274. !
  275. @LABEL 43
  276. note "Communicating at 9600 bps." 2
  277. CommunicatingAt 9600
  278. jump 60
  279. !
  280. @LABEL 44
  281. note "Communicating at 12400 bps." 2
  282. CommunicatingAt 12400
  283. jump 60
  284. !
  285. @LABEL 45
  286. note "Communicating at 14400 bps." 2
  287. CommunicatingAt 14400
  288. jump 60
  289. !
  290. @LABEL 46
  291. note "Communicating at 16800 bps." 2
  292. CommunicatingAt 16800
  293. jump 60
  294. !
  295. @LABEL 47
  296. note "Communicating at 19200 bps." 2
  297. CommunicatingAt 19200
  298. jump 60
  299. !
  300. @LABEL 48
  301. note "Communicating at 21600 bps." 2
  302. CommunicatingAt 21600
  303. jump 60
  304. !
  305. @LABEL 49
  306. note "Communicating at 24000 bps." 2
  307. CommunicatingAt 24000
  308. jump 60
  309. !
  310. @LABEL 50
  311. note "Communicating at 26400 bps." 2
  312. CommunicatingAt 26400
  313. jump 60
  314. !
  315. @LABEL 51
  316. note "Communicating at 28800 bps." 2
  317. CommunicatingAt 28800
  318. jump 60
  319. !
  320. @LABEL 52
  321. note "Communicating at 31200 bps." 2
  322. CommunicatingAt 31200
  323. jump 60
  324. !
  325. @LABEL 53
  326. note "Communicating at 33600 bps." 2
  327. CommunicatingAt 33600
  328. jump 60
  329. !
  330. @LABEL 54
  331. note "Communicating at 38400 bps." 2
  332. CommunicatingAt 38400
  333. jump 60
  334. !
  335. @LABEL 55
  336. note "Communicating at 48000 bps." 2
  337. CommunicatingAt 48000
  338. jump 60
  339. !
  340. @LABEL 56
  341. note "Communicating at 56000 bps." 2
  342. CommunicatingAt 56000
  343. jump 60
  344. !
  345. @LABEL 57
  346. note "Communicating at 57600 bps." 2
  347. CommunicatingAt 57600
  348. jump 60
  349. !
  350. @LABEL 58
  351. note "Communicating at 64000 bps." 2
  352. CommunicatingAt 64000
  353. jump 60
  354. !
  355. @LABEL 59
  356. note "Communicating at an unknown rate." 2
  357. jump 60
  358. !
  359. ! Look for reliablilty and compression results 
  360. ! at the end of the connect result.
  361. !
  362. @LABEL 60
  363. matchclr
  364. matchstr  1 63 "LAPM"
  365. matchstr  2 63 "REL"
  366. matchstr  3 63 "ARQ"
  367. matchstr  4 68 "COMP/"
  368. matchstr  5 68 "COMP\13"
  369. matchstr  6 63 "V42/"
  370. matchstr  7 63 "V42\13"
  371. matchstr  8 68 "V42BIS"
  372. matchstr  9 68 "V42bis"
  373. matchstr 10 63 "MNP\13"
  374. matchstr 11 68 "MNP5"
  375. matchstr 12 70 "\10"
  376. matchread 30
  377. jump 70
  378.  
  379. ! -- Modem error correction link negotiation --
  380. ! Userhook 2 informs ARA that a modem-to-modem error
  381. ! correcting protocol has been negotiated
  382. !
  383. !
  384. @LABEL 62
  385. note "Modem Reliable Link Established." 2
  386. userhook 2
  387. jump 32
  388. !
  389. @LABEL 63
  390. note "Modem Reliable Link Established." 2
  391. userhook 2
  392. jump 60
  393. !
  394. ! -- Compression negotiation --
  395. ! Userhook 3 informs ARA that a modem-to-modem compression
  396. ! protocol has been negotiated
  397. !
  398. @LABEL 67
  399. note "Modem Compression Established." 2
  400. userhook 3
  401. jump 32
  402. !
  403. @LABEL 68
  404. note "Modem Compression Established." 2
  405. userhook 3
  406. jump 60
  407. !
  408. !
  409. ! -- Normal exit after "CONNECT" --
  410. !
  411. !  This modem has been setup to do CTS handshaking,
  412. !  and we assume that a CTS handshaking cable is being used.
  413. !
  414. @LABEL 70
  415. ! Turn on CTS handshaking.
  416. HSReset 0 1 0 0 0 0
  417. !
  418. ifANSWER 71
  419. pause 30
  420. @LABEL 71
  421. exit 0
  422. !
  423. !
  424. ! ---- Answer calls ----
  425. !
  426. !    A RING result from the modem and in ANSWERING mode
  427. !    claims the serial port and answering the phone
  428. !
  429. @LABEL 81
  430. ifORIGINATE 32
  431. userhook 1
  432. note "Answering phone..." 2
  433. write "ATA\13"
  434. jump 32
  435. !
  436. !
  437. ! ---- Hang up and reset modem ----
  438. !
  439. @HANGUP
  440. @LABEL 90
  441. settries 0
  442. HSReset 0 0 0 0 0 0
  443. !
  444. @LABEL 92
  445. !  Escape from data to command mode
  446. matchclr
  447. matchstr 1 96 "OK\13\10"
  448. write "+++"
  449. matchread 20
  450. !
  451. @LABEL 94
  452. ! Force a hangup
  453. matchclr
  454. matchstr 1 98 "NO CARRIER\13\10"
  455. matchstr 2 98 "OK\13\10"
  456. matchstr 3 98 "ERROR\13\10"
  457. matchstr 4 98 "0\13\10"
  458. write "ATH\13"
  459. matchread 30
  460. ! Try to get control of the modem by toggling DTR
  461. DTRClear
  462. pause 5
  463. DTRSet
  464. flush
  465. !
  466. ! Try the hangup sequence three times otherwise declare and error
  467. inctries
  468. iftries 3 101
  469. jump 92
  470. !
  471. @LABEL 96
  472. ! Pause between data and command mode
  473. pause 50
  474. jump 94
  475. !
  476. !
  477. @LABEL 98
  478. ! Recall the factory settings
  479. pause 15
  480. matchclr
  481. matchstr 1 99 "OK\13\10"
  482. write "AT&F\13"
  483. matchread 30
  484. jump 101
  485. !
  486. @LABEL 99
  487. exit 0
  488. !
  489. ! ---- Error messages -----
  490. !
  491. ! Modem Not Responding
  492. @LABEL 101
  493. exit -6019
  494. !
  495. ! No Dial Tone
  496. @LABEL 102
  497. exit -6020
  498. !
  499. ! No Carrier or Error
  500. @LABEL 103
  501. exit -6021
  502. !
  503. ! Busy
  504. @LABEL 104
  505. exit -6022
  506. !
  507. ! No Answer
  508. @LABEL 105
  509. exit -6023
  510. !
  511. ! User Cancellation
  512. @LABEL 107
  513. exit -6008
  514.